Switch from got to ky + fetch in notion-client#394
Merged
transitive-bullshit merged 2 commits intoOct 31, 2024
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
|
This is awesome. Thanks for this. I will be happy to test it out on Cloudflare Workers once it's live. |
normdoow
approved these changes
Oct 18, 2022
Collaborator
normdoow
left a comment
There was a problem hiding this comment.
Looking good! This is really cool.
|
Hi, I wanted to know if there was any reason this PR isn't merge yet? |
|
is there any reasons that PR isn't merge? |
This was referenced Oct 31, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes
gotin favor ofkyinnotion-client. This means thatnotion-clientis no longer tied to Node.js.ky is a thin wrapper around
fetch, which makesnotion-clientcompatible with edge runtimes such as Cloudflare Workers, Vercel edge functions, and Deno.It also adds a secondary entrypoint to
notion-clientwhich will only be used by "browsers" (and this should include edge runtimes, though this hasn't been tested yet in practice).The node.js entrypoint bundles
ky-universal, which polyfillsnode-fetchandabort-controllerfor node.js so thatkyworks in node.js the same as any otherfetch-supported environment.The main advantage of using
kyinstead offetchdirectly is thatkyincludes robustness features such as automatic HTTP status code-aware retrying.The main downside of this change is that
gotis more robust on node.js than any otherfetch-based HTTP client that I'm aware of, includingky(thoughkyis the bestfetch-based HTTP client that I'm aware of).See @remorses previous PR which started this work in #312 and related discussion in #160
cc @pbteja1998 @MartinXPN @on2air